package com.jianganming.chain;

public abstract class Handler<T> {
    //下一个节点
    protected Handler next;
    //处理环节
    public abstract void doHandler(Member member);

    public static class Builder<T>{
        private Handler head;
        private Handler tail;
        //添加节点
        public Builder<T> addHandler(Handler handler){
            if(head==null){
                head = handler;
                tail = head;
            }else {
                tail.next=handler;
                tail = handler;
            }
            return this;
        }

        //返回第一个节点
        public Handler<T> build(){
            return head;
        }
    }
}
